package com.GainLoop;

import com.GainLoop.Api.Entity.Tag;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.widget.AutoCompleteTextView;
import android.widget.TextView;
import android.widget.Toast;

public class tagButtonListener implements View.OnClickListener{
	TextView _addedTags;
	AutoCompleteTextView _tagsRow;
	Context _context;
	
	private tagButtonListener(){
		super();
	}
	
	public tagButtonListener(TextView addedTags,AutoCompleteTextView tagsRow,Context context){
		this();
		_addedTags = addedTags;
		_tagsRow =  tagsRow ;
		_context = context;
	}
	@Override
	public void onClick(View arg0) {
		String newTag = _tagsRow.getText().toString();
		if(newTag.length()>Tag.MAX_TAG_LENGTH){
			Toast.makeText(_context, R.string.tag_exceeded_length, Toast.LENGTH_SHORT).show();
			return;
		}
		_addedTags.append(newTag+" , ");
		
	}

}
